<template>
  <div>
    <div class="allSecret">
      <div class="tab">
        <div class="tab_title">
          <li class="active" >全部秘密</li>
          <li @click="$router.push('/paySecret')">付费秘密</li>
          <li @click="$router.push('/writeSecret')">写秘密</li>
        </div>
        <p @click="$router.push('/')">>>返回首页</p>
      </div>
      <div class="banner">
        <div class="banner-left">
          <div class="item" v-for="(item,index) in secretList" :key="index">
            <div class="banner-left-title">
              <img :src="item.avatar" alt>
              <span>{{item.nickname}}</span>
              <span>{{item.add_time}}</span>
            </div>
            <div class="banner-left-content">{{item.title}}</div>
            <div class="banner-item">
              <li>
                <i class="iconfont icon-all-zhuanfa"></i>
                分享（
                <span>111</span>）
              </li>
              <li>
                <i class="iconfont icon-all-pinglun2"></i>
                评论（
                <span>111</span>）
              </li>
              <li>
                <i class="iconfont icon-all-like"></i>
                点赞（
                <span>111</span>）
              </li>
            </div>
          </div>
        </div>
        <div class="banner-right">
          <div class="tab-card1" style="display: block;">
              <div class="title">
                <span class="news">热门问答</span>
                <span class="more" @click="goQuestion">>>更多问答</span>
              </div>
              <div class="content" v-for="(item,index) in questionList" :key="index">
                <p @click="getQuestion(item)">
                  {{item.title}}
                </p>
                <div v-html="item.description" @click="getQuestion(item)">                           
                </div>
              </div>
            </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      questionList:[],
      secretList:[],
      secretIndex:10,
    };
  },
  methods: {
    //获取问答展示列表
    getquestionList(){  
      this.$axios
        .get("api/App/User/Question/get_list?limit=2&web=1", {
        })
        .then(res => {
          this.questionList = res.data.data.list;
          // console.log(this.questionList)
          
        });
    },
    //获取秘密列表
    getSecret(){
      this.$axios
        .get("api/App/User/Mimi/get_list?limit="+this.secretIndex, {
        })
        .then(res => {
          this.secretList = res.data.data.list;        
        })
    },
    //查看更多问答
    goQuestion(){
      this.$router.push("/pkQuestion");
    },
    //查看单个问答
    getQuestion(item){
     this.$router.push({path:"/replyQuestion",query:{questions_id:item.id}});
    },
  },
  mounted() {},
  created(){
 this.getquestionList();
 this.getSecret();
  },

  components: {}
};
</script>
<style lang="scss" scoped>
.allSecret {
  width: 100%;
  height: auto;
  background: #f8f8f8;
  margin-top: -60px;
  .tab {
    width: 100%;
    height: 100px;
    border-bottom: 3px solid #d0d0d0;
    display: flex;
    align-items: flex-end;
    position: relative;
    .tab_title {
      width: 1200px;
      margin: 0 auto;
      display: flex;
      justify-content: flex-start;
      list-style: none;
      li {
        margin-left: 20px;
        font-size: 20px;
        cursor: pointer;
        width: 120px;
      }
      .active{
        border-bottom:4px solid #5d90be;
        color:#5d90be;
      }
    }
    p{
     position: absolute; 
     top:70px;
     left:120px;
     color:#d0d0d0;
     font-size: 14px;
     &:hover{
       cursor: pointer;
       color:#5d90be;
     }
    }
  }
  .banner {
    width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    .banner-left {
      background: #fff;
      width: 700px;
      height: auto;
      text-align: left;
      padding-top: 10px;
      padding-left: 10px;
      .item {
        margin-bottom: 20px;
        .banner-left-title {
          img {
            width: 30px;
            height: 30px;
            border-radius: 100%;
          }
          span {
            font-size: 14px;
            color: #d0d0d0;
            margin-left: 10px;
          }
        }
        .banner-left-content {
          margin-top: 10px;
        }
        .banner-item {
          width: 540px;
          margin: 0 auto;
          display: flex;
          justify-content: space-between;
          list-style: none;
          margin-top: 10px;
        }
      }
    }
    .banner-right {
      background: #fff;
      width: 400px;
      height: auto;
      .tab-card1 {
          height: auto;
          display: none;
          margin-bottom: 20px;
          background: #fff;
          .title {          
            font-size: 20px;
            padding: 0 20px;
            padding-top: 5px;
            color: #5d90be;
            padding-top:20px;
            display: flex;
            justify-content: space-between;
            .more {
              font-size: 12px;
              display: inline-block;
              width: 70px;
              height: 30px;
              line-height: 30px;
              cursor: pointer;
            }
            .news{
              color: #9f9f9f;
              border-bottom:2px solid #5d90be;
            }
          }
          .content {
            margin-top: 10px;
            height: auto;
            div {
              color: #7a7b7c;
              cursor: pointer;
            }
            p {
              text-align: left;
              margin-left: 20px;
              display: flex;
              justify-content: flex-start;
              cursor: pointer;
              img {
                display: inline-block;
                width: 30px;
                height: 30px;
                border-radius: 50%;
              }
              span {
                display: inline-block;
                color: #5d90be;
                font-size: 10px;
                overflow: hidden;
                text-overflow:ellipsis;
                white-space: nowrap;
                line-height: 30px;
                padding-left: 10px;
                padding-right: 30px;
              }
            }
            div {
              // height: 155px;
              margin-top: -10px;
              text-align: left;
              padding: 0 15px;
              font-size: 12px;
              letter-spacing: 2px;
              padding-bottom: 10px;
              // overflow: hidden;
              //   text-overflow:ellipsis;
                // white-space: nowrap;
              span {
                color: #5d90be;
                margin-left: 10px;
                letter-spacing: 1px;
                cursor: pointer;
              }
            }
          }
        }

    }
  }
}
</style>


